<extend name="Public:common"/>
<block name="css">
    <style>
        .newMess th{text-align:center;}
        th{text-align: center;}
    </style>
</block>
<block name="content">
    <div class="page-header"><h1><i class="fa fa-home"></i> 首页>签证管理>签证列表

    </h1></div>
     <div class="container-fluid">
                 <table class="table table-striped table-bordered table-hover table-condensed text-center">
                     <tbody>
                         <tr>
                             <th style="width:10%;">ID</th>
                             <th>国家名称</th>
                             <th style="width:20%;">费用/元</th>
                             <th style="width:20%;">状态</th>
                             <th style="width:20%;">操作</th>
                         </tr>
                         <volist name="list" id="vo">
                         <tr>
                             <td>{$vo.visa_id}</td>
                             <td>{$vo.visa_name}</td>
                             <td>{$vo.visa_price}</td>
                             <td>
                                 <if condition="$vo['visa_status'] eq 0 ">
                                     下架
                                     <else/>
                                     上架
                                 </if>
                             </td>
                             <td>
                                 <if condition="checkAuth('Operator/Visa/editVisa')">
                                  <a  class="btn btn-xs btn-primary" href="{:U('editVisa',array('visa_id'=>$vo['visa_id']))}">编辑</a>
                                 </if>
                                 <if condition="checkAuth('Operator/Visa/visaStatus')">
                                     <if condition="$vo['visa_status'] eq 1">
                                         <a class="btn btn-xs btn-warning" href="javascript:visaStatus({$vo.visa_id},0)">下架</a>
                                         <else/>
                                         <a class="btn btn-xs btn-primary" href="javascript:visaStatus({$vo.visa_id},1)">上架</a>
                                     </if>
                                 </if>
                             </td>
                         </tr>
                         </volist>

                     </tbody>
                 </table>
                 <ul class="pagination">
                     {$show}
                 </ul>
             </div>
         </div>

     </div>

</block>
<block name="js">
    <script>
        /**
         * 更改上下架状态
         */
        function visaStatus(visa_id,visa_status) {
            $.ajax({
                type: 'POST',
                data: {visa_id:visa_id,visa_status:visa_status},
                url: '/index.php?m=Operator&c=Visa&a=visaStatus',
                dataType: 'json',
                success: function (data) {
                    layer.msg(data.msg);
                    if(data.status==1){
                        setTimeout(function(){
                            location.reload();
                        },1500);
                    }
                }
            });
        }

    </script>
</block>